package cn.jjxx.modules.activiti.servicetask;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.delegate.JavaDelegate;

import cn.jjxx.core.utils.SpringContextHolder;
import cn.jjxx.modules.activiti.controller.ActivitiFlowService;

/**
 * @Title: SendSmsToSubmitorServiceTask.java .<br>
 * @Package cn.jjxx.modules.activiti.servicetask .<br>
 * @Description: 自动发送短信至流程提交人 .<br>
 * @author 郑成功 .<br>
 * @email a876459952@qq.com .<br>
 * @date 2018-9-30 上午10:35:01.<br>
 * @version V1.0.<br>
 */
public class SendSmsToSubmitorServiceTask implements JavaDelegate{
	
	//流传变量-发送的内容
	private Expression content;

	@Override
	public void execute(DelegateExecution execution) throws Exception {
		if (content!=null) {
			String executionId = execution.getId();
			String msg = String.valueOf(content.getValue(execution));
			SpringContextHolder.getBean(ActivitiFlowService.class).sendSmsToSubmitor(execution.getProcessInstanceId(), msg, null);
		}
	}

}
